<?php
require_once './com.mrasong.class.whois.php';

$query    = empty( $_GET['q'] ) ? '' : $_GET['q'];
$datatype = empty( $_GET['t'] ) ? '' : $_GET['t'];
$callback = empty( $_GET['c'] ) ? '' : $_GET['c'];
/* 实例化 */
$whios = new Whios($query);

switch($datatype){
	case 'json':
		header("Content-type:text/plain;charset=utf-8");
		echo $whios->getJSON($callback);
		break;
	default:
		header("Content-type:text/html;charset=utf-8");
		echo $whios->getHTML();
		break;
}

echo <<<SFOOTER
<script type="text/javascript" src="http://mrasong.net/api/outer.footer.js"></script>
SFOOTER;

?>